#include <iostream>
#include <vector>
#include <limits>

using namespace std;

int RecursiveMaxValue( vector<int> &v, int index, int currMax = 0 );
int RecursiveMinValue( vector<int> &v, int index, int currMin = numeric_limits<int>::max() );
int RecursiveSumValue( vector<int> &v, int index, int currSum = 0 );
int RecursiveProdValue( vector<int> &v, int index, int currSum = 0);
double RecursiveMeanValue1( vector<int> &v, int index, double currSum = 0);
double RecursiveMeanValue2( vector<int> &v, int index, double currSum = 0);


int main( void )
{
	vector<int> v;

	for( int i = 0; i < 10; i++ )
		v.push_back(i+1);

	cout << "Vector contains: " << endl;
	for( auto i : v )
		cout << i << " ";
	cout << endl << endl;

	cout << "Max Value: " << RecursiveMaxValue( v, v.size()-1 ) << endl;
	cout << "Min Value: " << RecursiveMinValue( v, v.size()-1 ) << endl;
	cout << "Sum Value: " << RecursiveSumValue( v, v.size()-1 ) << endl;
	cout << "Prod Value: " << RecursiveProdValue( v, v.size()-1 ) << endl;
	cout << "Mean Value V1: " << RecursiveMeanValue1( v, v.size()-1 ) << endl;
	cout << "Mean Value V2: " << RecursiveMeanValue2( v, v.size()-1 ) << endl;

	cin.get();
	return 0;
}


int RecursiveMaxValue( vector<int> &v, int index, int currMax )
{
	if( index < 0 )
		return currMax;
	else
	{
		if( v[index] > currMax )
			currMax = v[index];
		return RecursiveMaxValue( v, index-1, currMax );
	}
}

int RecursiveMinValue( vector<int> &v, int index, int currMin )
{
	if( index < 0 )
		return currMin;
	else
	{
		if( v[index] < currMin )
			currMin = v[index];
		return RecursiveMinValue( v, index-1, currMin );
	}
}

int RecursiveSumValue( vector<int> &v, int index, int currSum )
{
	if( index < 0 )
		return currSum;
	else
	{
		currSum += v[index];
		return RecursiveSumValue( v, index-1, currSum );
	}
}

int RecursiveProdValue( vector<int> &v, int index, int currSum )
{
	if( index < 0 )
		return currSum;
	else
	{
		if( currSum == 0 )
			currSum = v[index];
		else
			currSum *= v[index];

		return RecursiveProdValue( v, index-1, currSum );
	}
}

double RecursiveMeanValue1( vector<int> &v, int index, double currSum )
{
	if( index < 0 )
		return currSum / v.size();
	else
	{
		currSum += v[index];
		return RecursiveMeanValue1( v, index-1, currSum );
	}
}

double RecursiveMeanValue2( vector<int> &v, int index, double currSum )
{
	return double(RecursiveSumValue( v, index, int(currSum))) / v.size();
}